const http =require('http');
const fs = require('fs');
const server = http.createServer();
server.on('request',function(request,response){

    response.setHeader('Access-Control-Allow-Origin','*');

    response.writeHead(200,{'Content-Type':'text/plain;charset= utf-8'});
    const data = fs.readFileSync('./data/news.json');
    response.end(data);
});

server.listen(3010,function(err){
    console.log('服务器创建成功！http://localhost:3010');
})